﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;

namespace VehicleRental.API
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            config.Routes.MapHttpRoute(
              name: "ReturnVehicleApi",
              routeTemplate: "api/places/return",
              defaults: new { controller = "places", action = "return" });

            config.Routes.MapHttpRoute(
              name: "RentVehicleApi",
              routeTemplate: "api/places/rent",
              defaults: new { controller = "places", action = "rent" });

            config.Routes.MapHttpRoute(
              name: "PlaceApi",
              routeTemplate: "api/places/{action}",
              defaults: new { controller = "places" });

            config.Routes.MapHttpRoute(
                name: "UserLoginApi",
                routeTemplate: "api/auth/token",
                defaults: new { controller = "users", action = "token" });

            config.Routes.MapHttpRoute(
                name: "UserApi",
                routeTemplate: "api/users/{action}",
                defaults: new { controller = "users" });

            config.Routes.MapHttpRoute(
               name: "AdvancedApi",
               routeTemplate: "api/{controller}/{action}",
               defaults: new { id = RouteParameter.Optional });

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional });

           
        }
    }
}
